const formatTimeInt = function(e){
    return (e>=10?'':'0')+e
}
const getTime=function(){
    let time = new Date()
    let year = time.getFullYear()
	let month = time.getMonth()+1
	let day = time.getDate()
	let hour = time.getHours()
	let min = time.getMinutes()
	let seconds = time.getSeconds()

    return {
        year,
        month:formatTimeInt(month),
        day:formatTimeInt(day),
        hour:formatTimeInt(hour),
        min:formatTimeInt(min),
        seconds:formatTimeInt(seconds),
        week:getWeek()
    }
}
const toThousands = function(num = 0)  {
    return num.toString().replace(/\d+/, function(n) {
       return n.replace(/(\d)(?=(?:\d{3})+$)/g, '$1,');
    });
 };
const getWeek=function(){
        var a=new Date().getDay();
        var b="";
        switch(a){
        	case 0:
        	    b="日";
        	    break;
        	case 1:
        	    b="一";
        	    break;
        	case 2:
        	    b="二";
        	    break;
        	case 3:
                b="三";
                break;
        	case 4:
                b="四";
                break;
        	case 5:
                b="五";
                break;
        	default:
        	    b="六";
        }
        return b
}
export default {
    getTime,
    getWeek,
    toThousands
}